package com.zl.learning.thread.timer;

import java.util.Timer;
import java.util.TimerTask;

public class TestTimer {
    public static void main(String[] args) {

        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("run------------>" + Thread.currentThread().getName());
            }
        }, 1000, 1000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("TimerTask2=========>" + Thread.currentThread().getName());
            }
        }, 1000, 1000);
//        timer.cancel();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("aaa");
            }
        }, 100, 100);
    }

}
